<template>
  <div class="">
    <gpBaseInfo ref="gpBaseInfo" />
    <div v-loading="loading" class="list-table bussRisk">
      <div>
        <ul class="distinguish">
          <li :class="{'active': 'coreTeam' === view}" @click="switchView('coreTeam')">
            <p>
              <span :title="$t('核心团队')">{{ $t('核心团队') }}</span>
              <span>{{ coreTeamCount }}</span>
            </p>
          </li>
          <li :class="{'active': 'remanageFund' === view}" @click="switchView('remanageFund')">
            <p>
              <span :title="$t('在管基金')">{{ $t('在管基金') }}</span>
              <span>{{ remanageFundCount }}</span>
            </p>
          </li>
          <li :class="{'active': 'votedProject' === view}" @click="switchView('votedProject')">
            <p>
              <span :title="$t('已投项目')">{{ $t('已投项目') }}</span>
              <span>{{ votedProjectCount }}</span>
            </p>
          </li>
        </ul>

      </div>
      <div v-if="view==='coreTeam'">
        <!-- 核心团队 -->
        <gpCoreTeamList />
      </div>
      <div v-if="view==='remanageFund'">
        <!-- 在管基金 -->
        <gpRemanageFundList />
      </div>
      <div v-if="view==='votedProject'">
        <!-- 在管基金 -->
        <gpVotedProjectList />
      </div>
    </div>
  </div>
</template>

<script>
  import { gpBaseInfo } from '@/components/Deal'
  import gpCoreTeamList from '@/views/fund/gpBase/coreTeam/gpCoreTeamList.vue'
  import gpRemanageFundList from '@/views/fund/gpBase/remanageFund/gpRemanageFundList'
  import gpVotedProjectList from '@/views/fund/gpBase/votedProject/gpVotedProjectList'
  import { listRiskTianyanchaUpdate } from '@/api/company/base/companyBase'
  export default {
    components: {
      gpBaseInfo,
      gpCoreTeamList,
      gpRemanageFundList,
      gpVotedProjectList
    },
  data() {
      return {
          // 遮罩层
          loading: false,
          // 弹出层标题
          title: '',
          // 表单参数
          form: {},
          // 查询参数
          queryParams: {
              id: this.$route.query.gpId
          },
          // 展示视图
          view: 'coreTeam',
          // 核心团队
          coreTeamCount: 0,
          // 核心团队
          remanageFundCount: 0,
          // 已投项目
          votedProjectCount: 0
      }
  },
  mounted() {
      this.onLoad()
  },
  methods: {
      onLoad() {
        // this.$refs.companyInfo.init()
        this.loading = true
        listRiskTianyanchaUpdate(this.queryParams).then(res => {
          if (res.code === 200) {
            this.coreTeamCount = res.data.coreTeamCount
            this.remanageFundCount = res.data.remanageFundCount
            this.votedProjectCount = res.data.votedProjectCount
            this.loading = false
          }
        })
      },
      // 切换视图
      switchView(view) {
        this.view = view
      }
  }
}
</script>
